类
class Point {
x: number = 0;
y: number;
// 使用索引签名定义动态方法
[fnName: string]: () => any;
constructor(x: number, y: number = 0) {
this.x = x;
this.y = y;
}
}
class Point {
x: number = 0;
y: number;
// 使用索引签名定义动态方法
[fnName: string]: () => any;
constructor(x: number, y: number = 0) {
this.x = x;
this.y = y;
}
}